package com.test.mylotterysystem.dao.Mapper;

import com.test.mylotterysystem.dao.DO.ActivityDO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ActivityMapper {

    @Insert("insert into activity (activity_name, description, status)" +
            " values (#{activityName}, #{description}, #{status})")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    void insertActivity(ActivityDO activityDO);

    @Select("select count(*) from activity")
    int activityCount();

    @Select("select * from activity order by id desc limit #{offset} , #{pageSize}")
    List<ActivityDO> getActivityList(int offset, Integer pageSize);
}
